const $api = require('../../utils/api').API.ad
const $cache = require('../../utils/storage')
Page({

  /**
   * 页面的初始数据
   */
  data: {
    adClassify: [{
      dec: "寒暑假工",
      url: 'https://easeview.oss-cn-shanghai.aliyuncs.com/staticPic/static/ad1.png'
    }, {
      dec: "驾校",
      url: 'https://easeview.oss-cn-shanghai.aliyuncs.com/staticPic/static/ad2.png'
    }, {
      dec: "考证",
      url: 'https://easeview.oss-cn-shanghai.aliyuncs.com/staticPic/static/ad3.png'
    }, {
      dec: "专升本",
      url: 'https://easeview.oss-cn-shanghai.aliyuncs.com/staticPic/static/ad4.png'
    },{
      dec: "兼职",
      url: 'https://easeview.oss-cn-shanghai.aliyuncs.com/staticPic/static/ad1.png'
    },],
    adList:[]
  },

  expectation(){
    wx.showToast({
      title: '敬请期待',
    })
  },
  goSendAd(){
    console.log(1)
    wx.redirectTo({
      url: '/pages/send_ad/send_ad',
    })
  },
  onLoad(options) {
    let openId = $cache._getStorage('openId')
    $api.getAdList({page:1,size:10,openId}).then(res=>{
      this.setData({
        adList:res.data.data.list
      })
    })
  },

  /**
   * 生命周期函数--监听页面初次渲染完成
   */
  onReady() {

  },

  /**
   * 生命周期函数--监听页面显示
   */
  onShow() {

  },

  /**
   * 生命周期函数--监听页面隐藏
   */
  onHide() {

  },

  /**
   * 生命周期函数--监听页面卸载
   */
  onUnload() {

  },

  /**
   * 页面相关事件处理函数--监听用户下拉动作
   */
  onPullDownRefresh() {

  },

  /**
   * 页面上拉触底事件的处理函数
   */
  onReachBottom() {

  },

  /**
   * 用户点击右上角分享
   */
  onShareAppMessage() {

  }
})